<?php //echo Yii::app()->request->baseUrl; ?>
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/assets/css/bootstrap.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/assets/css/bootstrap-responsive.css" type="text/css" media="screen" />
<div class="container">
	<div class="jumbotron">
<?php    
$rout_api = Yii::app()->request->baseUrl."routeros_api.class.php";
		require('routeros_api.class.php');
	
		$API = new routeros_api();
		/*
			$API->write('/system/clock/getall');
		$API->write('/system/resource/getall');
		$API->write('/system/resource/irq/getall');
		$API->write('/system/resource/pci/getall');
		*/
		//	$API->debug = true;
	
		if ($API->connect('192.168.88.1', 'admin', '')) {
	
			$API->write('/system/clock/getall');
			$API->write('/system/resource/getall');
			//$API->write('/system/resource/irq/getall');
			//$API->write('/system/resource/pci/getall');
	
			$READ = $API->read(false);
			$ARRAY = $API->parse_response($READ);
	
			///echo "<pre>";print_r($ARRAY);echo "</pre>";
	
			$API->disconnect();
	
		}
?>
<table class="table table-hover">
<head>
	<th>Time</th>
 	<th>Date</th>
 	<th>time-zone-name</th>
 	<th>gmt-offset</th>
 </head>
<tr>
        <td><?php echo $ARRAY[0]['time'];?></td>
        <td><?php echo  $ARRAY[0]['date']; ?></td>
        <td><?php echo  $ARRAY[0]['time-zone-name'];?></td>
        <td><?php echo  $ARRAY[0]['gmt-offset']; ?></td> 
 </tr>
</table>
<table class="table table-hover">
	 <tbody>
<?php 
foreach($ARRAY as $key => $value) {
  echo "$key is at $value";
}
foreach ($ARRAY as $data)
    {  

        $uptime=$data['uptime'];
        $version=$data['version'];
        $build_time=$data['build-time'];
        $free_memory=$data['free-memory'];
        $total_memory=$data['total-memory'];
        $cpu_count=$data['cpu-count'];
        $cpu=$data['cpu'];
        $cpu_frequency=$data['cpu-frequency'];
        $cpu_load=$data['cpu-load'];
        $free_hdd=$data['free-hdd-space'];
        $total_hdd=$data['total-hdd-space'];
        $write_sect=$data['write-sect-since-reboot'];
        $write_total=$data['write-sect-total'];
        $bad_blocks=$data['bad-blocks'];
        $architecture_name=$data['architecture-name'];
        $board_name=$data['board-name'];
        $platform=$data['platform'];
        
    if(isset($uptime)){

		foreach($data as $key => $value) {
			//echo "$key is at $value";
			?>
		 		 <tr>
		 		 <td width=20%><strong><?php echo $key?></strong></td>
		 		 <td><?php echo $value?></td>
		 		 </tr>
		 	 <?php 
		}
	?>      
 
   <?php }
    } 
    
    ?> 
   
     </tbody>
        </table>

	</div>
</div>

